<template>
	<view class="bodys">
		<view class="fileList flex-box boxSizing">
			<upload-Files ref="upFiles" :uploadFileUrl="uploadFileUrl" :uFileList.sync="uFileList" :formData="formData"
			 @uploadSuccess="uploadSuccess" :count="count"></upload-Files>
		</view>
		<button style="position: fixed;bottom: 5%;left: 25%;" type="default" @click="saveData()">上传文件</button>
	</view>
</template>

<script>
	import uploadFiles from '@/components/cn-h5uploadFile/upload-files';
	export default {
		components: {
			uploadFiles
		},
		data() {
			return {
				uFileList: [],//文件列表
				formData:{},
				uploadFileUrl:'',//上传路径
				count:5
			};
		},
		onLoad(options) {
			
		},
		onShow() {
			/* 上传路径 */
			this.uploadFileUrl = "";
			/* 额外参数 */
			this.formData = {
				'fileId': '0a3f45303e0b41ddb404b152aff7f0d1',
				'dirClass': '1'
			}
			
		},
		methods: {
			/* 上传 */
			saveData(){
				//对应组件的上传方法
				this.$refs.upFiles.upload();
			},
			
			/*上传成功回调 */
			uploadSuccess(result){
				console.log("上传成功回调",result)
				if(result.redata == "200"){
					uni.showToast({
						title:"上传成功"
					})
				}else{
					
				}
			},
		}
	}
</script>

<style scoped lang="less">
	.bodys{
		padding:0 0 20rpx 0;
		box-sizing: border-box;
	}
	button{
		width: 50%;
		height: 60rpx;
		font-size: 26rpx;
		line-height: 60rpx;
		margin-top: 20rpx;
	}
	.fileList{
		padding: 30rpx;
		margin-top: 40rpx;
	}
</style>
